@extends('home.common.layout')

@section('title', isset($category)?$category->name:(isset($tag)?$tag->name:(isset($search)?$search.' 搜索结果':'首页')))

@section('content')
    @foreach($articles as $article)
        <div class="title-article list-card">
            <div class="list-pic">
                <a href="{{ url("/article/$article->id") }}" title="{{ $article->title }}">
                    <img lay-src="{{ $article->thumb }}" alt="{{ $article->title }}" class="img-full">
                </a>
            </div>
            <a href="{{ url("/article/$article->id") }}">
                <h1>{{ $article->title }}</h1>
                {{ $article->description }}
            </a>
            <div class="title-msg">
                <span><i class="layui-icon">&#xe705;</i>
                    <a href="{{ url("/category/{$article->category->id}") }}">{{ $article->category->name }}</a>
                </span>
                <span><i class="layui-icon">&#xe60e;</i> {{ $article->created_at }} </span>
                <span class="layui-hide-xs"><i class="layui-icon">&#xe62c;</i> {{ $article->click }}℃</span>
                <span class="layui-hide-xs"><i class="layui-icon">&#xe63a;</i> {{ $article->comment->count() }}条</span>
            </div>
        </div>
    @endforeach
    <div class="page-navigator">
        @isset($search)
            {{ $articles->appends(['search' => $search])->links('vendor.pagination.ringer_page') }}
        @else
            {{ $articles->links('vendor.pagination.ringer_page') }}
        @endisset
    </div>
@endsection